<?php
if (empty ( $l0 )) :
	if (! empty ( $O0 )) :
		if (empty ( $l1 )) :
			if (! empty ( $O0 )) :
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
			 endif;
			$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
			$l2 = $O1->info ( 'name' );
			$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
			$l3 = $O2->query ()->fetchall ();
			if (! empty ( $l3 )) {
				$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
			}
			$O3 = 'sitepagebadge';
			$l4 = 0;
			$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
			$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
			$O4 = $O3 . '.navi.auth';
			$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
			$O5 = $this->getrequest ()->getpost ();
			if (! empty ( $O5 )) {
				if (empty ( $l5 )) {
					$l6 = $O5 ['environment_mode'];
				}
				$O5 = $O5 [$O3 . '_lsettings'];
			}
			if (empty ( $l5 )) {
				$form->setdescription ( '' );
				foreach ( $onactive_disabled as $O6 ) {
					$form->removeelement ( $O6 );
				}
			} else {
				foreach ( $afteractive_disabled as $l7 ) {
					$form->removeelement ( $l7 );
				}
			}
		 endif;
		if (empty ( $O7 )) :
			if (! empty ( $l8 )) :
				if ($O5) {
					$O8 = '';
					$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
					foreach ( $l9 as $O9 ) {
						switch ($O9->ptype ()) {
							case 'userconnection' :
								$name = 'userconnection';
								$la = 'user.licensekey';
								break;
							case 'feedbacks' :
								$name = 'feedback';
								$la = 'feedback.license_key';
								break;
							case 'suggestion' :
								$name = 'suggestion';
								$la = 'suggestion.controllersettings';
								break;
							case 'peopleyoumayknow' :
								$name = 'peopleyoumayknow';
								$la = 'pymk.controllersettings';
								break;
							case 'siteslideshow' :
								$name = 'siteslideshow';
								$la = 'siteslideshow.controllersettings';
								break;
							case 'mapprofiletypelevel' :
								$name = 'mapprofiletypelevel';
								$la = 'mapprofiletypelevel.controllersettings';
								break;
							case 'documentsv4' :
								$name = 'document';
								$la = 'document.controllersettings';
								break;
							case 'groupdocumentsv4' :
								$name = 'groupdocument';
								$la = 'groupdocument.controllersettings';
								break;
							case 'backup' :
								$name = 'dbbackup';
								$la = 'dbbackup.controllersettings';
								break;
							case 'mcard' :
								$name = 'mcard';
								$la = 'mcard.controllersettings';
								break;
							case 'like' :
								$name = 'sitelike';
								$la = 'sitelike.controllersettings';
								break;
							default :
								$name = $O9->ptype ();
								$la = $O9->ptype () . '.lsettings';
								break;
						}
						$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
						$moduleName = $moduleTable->info ( 'name' );
						$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
						$Oa = $select->query ()->fetchall ();
						if (! empty ( $Oa )) {
							$lb ['version'] = $Oa [0] ['version'];
							$lb ['enabled'] = $Oa [0] ['enabled'];
							$lb ['status'] = 1;
						} else {
							$lb ['status'] = 0;
						}
						$lb ['key'] = $la;
						$Ob = $lb;
						$lc = '';
						if (! empty ( $Ob ['status'] )) {
							if (! empty ( $lb ['enabled'] )) {
								$lc .= '::' . $O9->ptype () . ':1';
							} else {
								$lc .= '::' . $O9->ptype () . ':0';
							}
						}
					}
					$O8 = ltrim ( $O8, '::' );
					$Oc = 'EventLikeShow';
					$ld = 0;
					$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
					$le = $O5;
					$le = trim ( $le );
					if (empty ( $Oe )) {
						$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
						$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
						if (empty ( $lg )) {
							$Og = curl_init ();
							$lh = 0;
							curl_setopt ( $Og, CURLOPT_URL, $Of );
							curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
							ob_start ();
							curl_exec ( $Og );
							curl_close ( $Og );
							$Oh = ob_get_contents ();
							if (empty ( $Oh )) {
								$Oh = @file_get_contents ( $Of );
							}
							ob_end_clean ();
						}
						if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
							$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
							$lj = 1;
						}
						if (empty ( $lj )) {
							if (empty ( $l5 )) {
								$Oj = 'meraMODULE' . $O3 . 'plugin.php';
							} else {
								$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
							}
							$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
							$Ok = 'ASDsdas';
							$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
							if (empty ( $get_value )) {
								$lm = $lk;
								$Om = curl_init ();
								$ln = 0;
								curl_setopt ( $Om, CURLOPT_URL, $lm );
								curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
								ob_start ();
								curl_exec ( $Om );
								curl_close ( $Om );
								if (empty ( $On )) {
									$get_value = ob_get_contents ();
								}
								if (empty ( $get_value )) {
									$get_value = @file_get_contents ( $lk );
								}
								ob_end_clean ();
							}
						}
					} else {
						include $file_path;
					}
					$lo = strrev ( $O3 );
					if (strstr ( $get_value, $lo )) {
						$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
						$lp = serialize ( $Oo );
						$Op = convert_uuencode ( $lp );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
						$lq = convert_uuencode ( $Od );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
						engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
						if (empty ( $l5 )) {
							$Oq = explode ( '::', $get_value );
							if (! empty ( $Oq )) {
								$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
							}
							$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
							$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
							$ls = $O2->info ( 'name' );
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Oq = explode ( ';', $Oq );
								foreach ( $Oq as $lt ) {
									if (! empty ( $lt )) {
										$lr->query ( $lt );
									}
								}
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_manage';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badges';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 2;
								$Ot->save ();
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_badgerequest';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badge Requests';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 3;
								$Ot->save ();
							}
							$db = Zend_Db_Table_Abstract::getdefaultadapter ();
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
							$lu = $select->query ()->fetchall ();
							if (! empty ( $lu )) {
								$Ou = $lu [0] ['value'];
							} else {
								$Ou = 0;
							}
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
							$lv = $select->query ()->fetchobject ();
							if (! empty ( $lv ) && ! empty ( $Ou )) {
								$select = new Zend_Db_Select ( $db );
								$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
								$page = $Ov->query ()->fetchall ();
								if (! empty ( $page )) {
									$page_id = $page [0] ['page_id'];
									$select = new Zend_Db_Select ( $db );
									$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
									$Ow = $lw->query ()->fetchall ();
									if (empty ( $Ow )) {
										$select = new Zend_Db_Select ( $db );
										$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
										$Ox = $lx->query ()->fetchall ();
										if (! empty ( $Ox )) {
											$ly = $Ox [0] ['content_id'];
											$select = new Zend_Db_Select ( $db );
											$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
											$lz = $Oy->query ()->fetchall ();
											if (! empty ( $lz )) {
												$Oz = $lz [0] ['content_id'];
												$select = new Zend_Db_Select ( $db );
												$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
												$O10 = $l10->query ()->fetchall ();
												if (! empty ( $O10 )) {
													$l11 = $O10 [0] ['content_id'];
												}
												$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
											}
											$select = new Zend_Db_Select ( $db );
											$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
											$O11 = $select->query ()->fetchall ();
											foreach ( $O11 as $l12 ) {
												if (! empty ( $l12 )) {
													$page_id = $l12 ['contentpage_id'];
													$select = new Zend_Db_Select ( $db );
													$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
													$Ow = $lw->query ()->fetchall ();
													if (empty ( $Ow )) {
														$select = new Zend_Db_Select ( $db );
														$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
														$Ox = $lx->query ()->fetchall ();
														if (! empty ( $Ox )) {
															$ly = $Ox [0] ['content_id'];
															$select = new Zend_Db_Select ( $db );
															$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
															$lz = $Oy->query ()->fetchall ();
															if (! empty ( $lz )) {
																$Oz = $lz [0] ['content_id'];
																$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
															}
														}
													}
												}
											}
										}
									}
								}
							}
							if (! empty ( $l6 )) {
								$O12 = APPLICATION_PATH . '/application/settings/general.php';
								if (file_exists ( $O12 )) {
									$l13 = include $O12;
								} else {
									$l13 = array ();
								}
								if (! is_writable ( $O12 )) {
									@chmod ( $O12, 0666 );
								}
								$l13 ['environment_mode'] = 'development';
								$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
								$O13 .= var_export ( $l13, TRUE );
								$O13 .= '; ?>';
								@file_put_contents ( $O12, $O13 );
							}
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
							}
							$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
						} else {
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
								foreach ( $values as $key => $value ) {
									if ($key != 'submit') {
										engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
									}
								}
							}
						}
						$l4 = FALSE;
					} elseif (strstr ( $get_value, 'error' )) {
						$l4 = str_replace ( 'error::', '', $get_value );
					} else {
						$l4 = 'This license key is not valid';
					}
				}
			 endif;
			$file_path = APPLICATION_PATH . '/application/modules/' . ucfirst ( $O3 ) . '/controllers/license/ilicense.php';
			$Oe = file_exists ( $file_path );
			$l14 = engine_api::_ ()->getdbtable ( 'modules', 'core' )->ismoduleenabled ( 'socialengineaddon' );
			if (empty ( $l14 ) && empty ( $Oe )) {
				$l4 = '<a href="http://www.socialengineaddons.com/resources/socialengineaddons-core-plugin-free" target="_blank">The SocialEngineAddOns Core Plugin</a> is not installed on your site. Please download the latest version of this FREE plugin from your Client Area on <a href="http://www.socialengineaddons.com" target="_blank">SocialEngineAddOns</a>.';
			} else {
				if ($O5) {
					$O8 = '';
					$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
					foreach ( $l9 as $O9 ) {
						switch ($O9->ptype ()) {
							case 'userconnection' :
								$name = 'userconnection';
								$la = 'user.licensekey';
								break;
							case 'feedbacks' :
								$name = 'feedback';
								$la = 'feedback.license_key';
								break;
							case 'suggestion' :
								$name = 'suggestion';
								$la = 'suggestion.controllersettings';
								break;
							case 'peopleyoumayknow' :
								$name = 'peopleyoumayknow';
								$la = 'pymk.controllersettings';
								break;
							case 'siteslideshow' :
								$name = 'siteslideshow';
								$la = 'siteslideshow.controllersettings';
								break;
							case 'mapprofiletypelevel' :
								$name = 'mapprofiletypelevel';
								$la = 'mapprofiletypelevel.controllersettings';
								break;
							case 'documentsv4' :
								$name = 'document';
								$la = 'document.controllersettings';
								break;
							case 'groupdocumentsv4' :
								$name = 'groupdocument';
								$la = 'groupdocument.controllersettings';
								break;
							case 'backup' :
								$name = 'dbbackup';
								$la = 'dbbackup.controllersettings';
								break;
							case 'mcard' :
								$name = 'mcard';
								$la = 'mcard.controllersettings';
								break;
							case 'like' :
								$name = 'sitelike';
								$la = 'sitelike.controllersettings';
								break;
							default :
								$name = $O9->ptype ();
								$la = $O9->ptype () . '.lsettings';
								break;
						}
						$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
						$moduleName = $moduleTable->info ( 'name' );
						$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
						$Oa = $select->query ()->fetchall ();
						if (! empty ( $Oa )) {
							$lb ['version'] = $Oa [0] ['version'];
							$lb ['enabled'] = $Oa [0] ['enabled'];
							$lb ['status'] = 1;
						} else {
							$lb ['status'] = 0;
						}
						$lb ['key'] = $la;
						$Ob = $lb;
						$lc = '';
						if (! empty ( $Ob ['status'] )) {
							if (! empty ( $lb ['enabled'] )) {
								$lc .= '::' . $O9->ptype () . ':1';
							} else {
								$lc .= '::' . $O9->ptype () . ':0';
							}
						}
					}
					$O8 = ltrim ( $O8, '::' );
					$Oc = 'EventLikeShow';
					$ld = 0;
					$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
					$le = $O5;
					$le = trim ( $le );
					if (empty ( $Oe )) {
						$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
						$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
						if (empty ( $lg )) {
							$Og = curl_init ();
							$lh = 0;
							curl_setopt ( $Og, CURLOPT_URL, $Of );
							curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
							ob_start ();
							curl_exec ( $Og );
							curl_close ( $Og );
							$Oh = ob_get_contents ();
							if (empty ( $Oh )) {
								$Oh = @file_get_contents ( $Of );
							}
							ob_end_clean ();
						}
						if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
							$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
							$lj = 1;
						}
						if (empty ( $lj )) {
							if (empty ( $l5 )) {
								$Oj = 'meraMODULE' . $O3 . 'plugin.php';
							} else {
								$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
							}
							$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
							$Ok = 'ASDsdas';
							$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
							if (empty ( $get_value )) {
								$lm = $lk;
								$Om = curl_init ();
								$ln = 0;
								curl_setopt ( $Om, CURLOPT_URL, $lm );
								curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
								ob_start ();
								curl_exec ( $Om );
								curl_close ( $Om );
								if (empty ( $On )) {
									$get_value = ob_get_contents ();
								}
								if (empty ( $get_value )) {
									$get_value = @file_get_contents ( $lk );
								}
								ob_end_clean ();
							}
						}
					} else {
						include $file_path;
					}
					$lo = strrev ( $O3 );
					if (strstr ( $get_value, $lo )) {
						$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
						$lp = serialize ( $Oo );
						$Op = convert_uuencode ( $lp );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
						$lq = convert_uuencode ( $Od );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
						engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
						if (empty ( $l5 )) {
							$Oq = explode ( '::', $get_value );
							if (! empty ( $Oq )) {
								$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
							}
							$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
							$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
							$ls = $O2->info ( 'name' );
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Oq = explode ( ';', $Oq );
								foreach ( $Oq as $lt ) {
									if (! empty ( $lt )) {
										$lr->query ( $lt );
									}
								}
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_manage';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badges';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 2;
								$Ot->save ();
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_badgerequest';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badge Requests';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 3;
								$Ot->save ();
							}
							$db = Zend_Db_Table_Abstract::getdefaultadapter ();
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
							$lu = $select->query ()->fetchall ();
							if (! empty ( $lu )) {
								$Ou = $lu [0] ['value'];
							} else {
								$Ou = 0;
							}
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
							$lv = $select->query ()->fetchobject ();
							if (! empty ( $lv ) && ! empty ( $Ou )) {
								$select = new Zend_Db_Select ( $db );
								$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
								$page = $Ov->query ()->fetchall ();
								if (! empty ( $page )) {
									$page_id = $page [0] ['page_id'];
									$select = new Zend_Db_Select ( $db );
									$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
									$Ow = $lw->query ()->fetchall ();
									if (empty ( $Ow )) {
										$select = new Zend_Db_Select ( $db );
										$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
										$Ox = $lx->query ()->fetchall ();
										if (! empty ( $Ox )) {
											$ly = $Ox [0] ['content_id'];
											$select = new Zend_Db_Select ( $db );
											$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
											$lz = $Oy->query ()->fetchall ();
											if (! empty ( $lz )) {
												$Oz = $lz [0] ['content_id'];
												$select = new Zend_Db_Select ( $db );
												$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
												$O10 = $l10->query ()->fetchall ();
												if (! empty ( $O10 )) {
													$l11 = $O10 [0] ['content_id'];
												}
												$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
											}
											$select = new Zend_Db_Select ( $db );
											$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
											$O11 = $select->query ()->fetchall ();
											foreach ( $O11 as $l12 ) {
												if (! empty ( $l12 )) {
													$page_id = $l12 ['contentpage_id'];
													$select = new Zend_Db_Select ( $db );
													$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
													$Ow = $lw->query ()->fetchall ();
													if (empty ( $Ow )) {
														$select = new Zend_Db_Select ( $db );
														$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
														$Ox = $lx->query ()->fetchall ();
														if (! empty ( $Ox )) {
															$ly = $Ox [0] ['content_id'];
															$select = new Zend_Db_Select ( $db );
															$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
															$lz = $Oy->query ()->fetchall ();
															if (! empty ( $lz )) {
																$Oz = $lz [0] ['content_id'];
																$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
															}
														}
													}
												}
											}
										}
									}
								}
							}
							if (! empty ( $l6 )) {
								$O12 = APPLICATION_PATH . '/application/settings/general.php';
								if (file_exists ( $O12 )) {
									$l13 = include $O12;
								} else {
									$l13 = array ();
								}
								if (! is_writable ( $O12 )) {
									@chmod ( $O12, 0666 );
								}
								$l13 ['environment_mode'] = 'development';
								$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
								$O13 .= var_export ( $l13, TRUE );
								$O13 .= '; ?>';
								@file_put_contents ( $O12, $O13 );
							}
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
							}
							$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
						} else {
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
								foreach ( $values as $key => $value ) {
									if ($key != 'submit') {
										engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
									}
								}
							}
						}
						$l4 = FALSE;
					} elseif (strstr ( $get_value, 'error' )) {
						$l4 = str_replace ( 'error::', '', $get_value );
					} else {
						$l4 = 'This license key is not valid';
					}
				}
			}
			if (! empty ( $Oi )) {
				$ld = 1;
				$this->view->status = FALSE;
				$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
				$error = $Oi;
				$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
				$form->adderror ( $error );
				return;
			} else if (! empty ( $l4 )) {
				$ld = 1;
				$this->view->status = FALSE;
				$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
				$error = $l4;
				$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
				$form->adderror ( $error );
				return;
			}
		 endif;
		if (empty ( $l1 )) :
			if (! empty ( $O0 )) :
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
			 endif;
			$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
			$l2 = $O1->info ( 'name' );
			$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
			$l3 = $O2->query ()->fetchall ();
			if (! empty ( $l3 )) {
				$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
			}
			$O3 = 'sitepagebadge';
			$l4 = 0;
			$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
			$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
			$O4 = $O3 . '.navi.auth';
			$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
			$O5 = $this->getrequest ()->getpost ();
			if (! empty ( $O5 )) {
				if (empty ( $l5 )) {
					$l6 = $O5 ['environment_mode'];
				}
				$O5 = $O5 [$O3 . '_lsettings'];
			}
			if (empty ( $l5 )) {
				$form->setdescription ( '' );
				foreach ( $onactive_disabled as $O6 ) {
					$form->removeelement ( $O6 );
				}
			} else {
				foreach ( $afteractive_disabled as $l7 ) {
					$form->removeelement ( $l7 );
				}
			}
		 endif;
		if (empty ( $O7 )) :
			if (! empty ( $l8 )) :
				if ($O5) {
					$O8 = '';
					$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
					foreach ( $l9 as $O9 ) {
						switch ($O9->ptype ()) {
							case 'userconnection' :
								$name = 'userconnection';
								$la = 'user.licensekey';
								break;
							case 'feedbacks' :
								$name = 'feedback';
								$la = 'feedback.license_key';
								break;
							case 'suggestion' :
								$name = 'suggestion';
								$la = 'suggestion.controllersettings';
								break;
							case 'peopleyoumayknow' :
								$name = 'peopleyoumayknow';
								$la = 'pymk.controllersettings';
								break;
							case 'siteslideshow' :
								$name = 'siteslideshow';
								$la = 'siteslideshow.controllersettings';
								break;
							case 'mapprofiletypelevel' :
								$name = 'mapprofiletypelevel';
								$la = 'mapprofiletypelevel.controllersettings';
								break;
							case 'documentsv4' :
								$name = 'document';
								$la = 'document.controllersettings';
								break;
							case 'groupdocumentsv4' :
								$name = 'groupdocument';
								$la = 'groupdocument.controllersettings';
								break;
							case 'backup' :
								$name = 'dbbackup';
								$la = 'dbbackup.controllersettings';
								break;
							case 'mcard' :
								$name = 'mcard';
								$la = 'mcard.controllersettings';
								break;
							case 'like' :
								$name = 'sitelike';
								$la = 'sitelike.controllersettings';
								break;
							default :
								$name = $O9->ptype ();
								$la = $O9->ptype () . '.lsettings';
								break;
						}
						$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
						$moduleName = $moduleTable->info ( 'name' );
						$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
						$Oa = $select->query ()->fetchall ();
						if (! empty ( $Oa )) {
							$lb ['version'] = $Oa [0] ['version'];
							$lb ['enabled'] = $Oa [0] ['enabled'];
							$lb ['status'] = 1;
						} else {
							$lb ['status'] = 0;
						}
						$lb ['key'] = $la;
						$Ob = $lb;
						$lc = '';
						if (! empty ( $Ob ['status'] )) {
							if (! empty ( $lb ['enabled'] )) {
								$lc .= '::' . $O9->ptype () . ':1';
							} else {
								$lc .= '::' . $O9->ptype () . ':0';
							}
						}
					}
					$O8 = ltrim ( $O8, '::' );
					$Oc = 'EventLikeShow';
					$ld = 0;
					$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
					$le = $O5;
					$le = trim ( $le );
					if (empty ( $Oe )) {
						$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
						$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
						if (empty ( $lg )) {
							$Og = curl_init ();
							$lh = 0;
							curl_setopt ( $Og, CURLOPT_URL, $Of );
							curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
							ob_start ();
							curl_exec ( $Og );
							curl_close ( $Og );
							$Oh = ob_get_contents ();
							if (empty ( $Oh )) {
								$Oh = @file_get_contents ( $Of );
							}
							ob_end_clean ();
						}
						if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
							$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
							$lj = 1;
						}
						if (empty ( $lj )) {
							if (empty ( $l5 )) {
								$Oj = 'meraMODULE' . $O3 . 'plugin.php';
							} else {
								$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
							}
							$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
							$Ok = 'ASDsdas';
							$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
							if (empty ( $get_value )) {
								$lm = $lk;
								$Om = curl_init ();
								$ln = 0;
								curl_setopt ( $Om, CURLOPT_URL, $lm );
								curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
								ob_start ();
								curl_exec ( $Om );
								curl_close ( $Om );
								if (empty ( $On )) {
									$get_value = ob_get_contents ();
								}
								if (empty ( $get_value )) {
									$get_value = @file_get_contents ( $lk );
								}
								ob_end_clean ();
							}
						}
					} else {
						include $file_path;
					}
					$lo = strrev ( $O3 );
					if (strstr ( $get_value, $lo )) {
						$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
						$lp = serialize ( $Oo );
						$Op = convert_uuencode ( $lp );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
						$lq = convert_uuencode ( $Od );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
						engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
						if (empty ( $l5 )) {
							$Oq = explode ( '::', $get_value );
							if (! empty ( $Oq )) {
								$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
							}
							$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
							$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
							$ls = $O2->info ( 'name' );
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Oq = explode ( ';', $Oq );
								foreach ( $Oq as $lt ) {
									if (! empty ( $lt )) {
										$lr->query ( $lt );
									}
								}
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_manage';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badges';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 2;
								$Ot->save ();
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_badgerequest';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badge Requests';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 3;
								$Ot->save ();
							}
							$db = Zend_Db_Table_Abstract::getdefaultadapter ();
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
							$lu = $select->query ()->fetchall ();
							if (! empty ( $lu )) {
								$Ou = $lu [0] ['value'];
							} else {
								$Ou = 0;
							}
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
							$lv = $select->query ()->fetchobject ();
							if (! empty ( $lv ) && ! empty ( $Ou )) {
								$select = new Zend_Db_Select ( $db );
								$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
								$page = $Ov->query ()->fetchall ();
								if (! empty ( $page )) {
									$page_id = $page [0] ['page_id'];
									$select = new Zend_Db_Select ( $db );
									$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
									$Ow = $lw->query ()->fetchall ();
									if (empty ( $Ow )) {
										$select = new Zend_Db_Select ( $db );
										$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
										$Ox = $lx->query ()->fetchall ();
										if (! empty ( $Ox )) {
											$ly = $Ox [0] ['content_id'];
											$select = new Zend_Db_Select ( $db );
											$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
											$lz = $Oy->query ()->fetchall ();
											if (! empty ( $lz )) {
												$Oz = $lz [0] ['content_id'];
												$select = new Zend_Db_Select ( $db );
												$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
												$O10 = $l10->query ()->fetchall ();
												if (! empty ( $O10 )) {
													$l11 = $O10 [0] ['content_id'];
												}
												$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
											}
											$select = new Zend_Db_Select ( $db );
											$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
											$O11 = $select->query ()->fetchall ();
											foreach ( $O11 as $l12 ) {
												if (! empty ( $l12 )) {
													$page_id = $l12 ['contentpage_id'];
													$select = new Zend_Db_Select ( $db );
													$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
													$Ow = $lw->query ()->fetchall ();
													if (empty ( $Ow )) {
														$select = new Zend_Db_Select ( $db );
														$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
														$Ox = $lx->query ()->fetchall ();
														if (! empty ( $Ox )) {
															$ly = $Ox [0] ['content_id'];
															$select = new Zend_Db_Select ( $db );
															$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
															$lz = $Oy->query ()->fetchall ();
															if (! empty ( $lz )) {
																$Oz = $lz [0] ['content_id'];
																$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
															}
														}
													}
												}
											}
										}
									}
								}
							}
							if (! empty ( $l6 )) {
								$O12 = APPLICATION_PATH . '/application/settings/general.php';
								if (file_exists ( $O12 )) {
									$l13 = include $O12;
								} else {
									$l13 = array ();
								}
								if (! is_writable ( $O12 )) {
									@chmod ( $O12, 0666 );
								}
								$l13 ['environment_mode'] = 'development';
								$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
								$O13 .= var_export ( $l13, TRUE );
								$O13 .= '; ?>';
								@file_put_contents ( $O12, $O13 );
							}
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
							}
							$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
						} else {
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
								foreach ( $values as $key => $value ) {
									if ($key != 'submit') {
										engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
									}
								}
							}
						}
						$l4 = FALSE;
					} elseif (strstr ( $get_value, 'error' )) {
						$l4 = str_replace ( 'error::', '', $get_value );
					} else {
						$l4 = 'This license key is not valid';
					}
				}
			 endif;
			$file_path = APPLICATION_PATH . '/application/modules/' . ucfirst ( $O3 ) . '/controllers/license/ilicense.php';
			$Oe = file_exists ( $file_path );
			$l14 = engine_api::_ ()->getdbtable ( 'modules', 'core' )->ismoduleenabled ( 'socialengineaddon' );
			if (empty ( $l14 ) && empty ( $Oe )) {
				$l4 = '<a href="http://www.socialengineaddons.com/resources/socialengineaddons-core-plugin-free" target="_blank">The SocialEngineAddOns Core Plugin</a> is not installed on your site. Please download the latest version of this FREE plugin from your Client Area on <a href="http://www.socialengineaddons.com" target="_blank">SocialEngineAddOns</a>.';
			} else {
				if ($O5) {
					$O8 = '';
					$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
					foreach ( $l9 as $O9 ) {
						switch ($O9->ptype ()) {
							case 'userconnection' :
								$name = 'userconnection';
								$la = 'user.licensekey';
								break;
							case 'feedbacks' :
								$name = 'feedback';
								$la = 'feedback.license_key';
								break;
							case 'suggestion' :
								$name = 'suggestion';
								$la = 'suggestion.controllersettings';
								break;
							case 'peopleyoumayknow' :
								$name = 'peopleyoumayknow';
								$la = 'pymk.controllersettings';
								break;
							case 'siteslideshow' :
								$name = 'siteslideshow';
								$la = 'siteslideshow.controllersettings';
								break;
							case 'mapprofiletypelevel' :
								$name = 'mapprofiletypelevel';
								$la = 'mapprofiletypelevel.controllersettings';
								break;
							case 'documentsv4' :
								$name = 'document';
								$la = 'document.controllersettings';
								break;
							case 'groupdocumentsv4' :
								$name = 'groupdocument';
								$la = 'groupdocument.controllersettings';
								break;
							case 'backup' :
								$name = 'dbbackup';
								$la = 'dbbackup.controllersettings';
								break;
							case 'mcard' :
								$name = 'mcard';
								$la = 'mcard.controllersettings';
								break;
							case 'like' :
								$name = 'sitelike';
								$la = 'sitelike.controllersettings';
								break;
							default :
								$name = $O9->ptype ();
								$la = $O9->ptype () . '.lsettings';
								break;
						}
						$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
						$moduleName = $moduleTable->info ( 'name' );
						$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
						$Oa = $select->query ()->fetchall ();
						if (! empty ( $Oa )) {
							$lb ['version'] = $Oa [0] ['version'];
							$lb ['enabled'] = $Oa [0] ['enabled'];
							$lb ['status'] = 1;
						} else {
							$lb ['status'] = 0;
						}
						$lb ['key'] = $la;
						$Ob = $lb;
						$lc = '';
						if (! empty ( $Ob ['status'] )) {
							if (! empty ( $lb ['enabled'] )) {
								$lc .= '::' . $O9->ptype () . ':1';
							} else {
								$lc .= '::' . $O9->ptype () . ':0';
							}
						}
					}
					$O8 = ltrim ( $O8, '::' );
					$Oc = 'EventLikeShow';
					$ld = 0;
					$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
					$le = $O5;
					$le = trim ( $le );
					if (empty ( $Oe )) {
						$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
						$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
						if (empty ( $lg )) {
							$Og = curl_init ();
							$lh = 0;
							curl_setopt ( $Og, CURLOPT_URL, $Of );
							curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
							ob_start ();
							curl_exec ( $Og );
							curl_close ( $Og );
							$Oh = ob_get_contents ();
							if (empty ( $Oh )) {
								$Oh = @file_get_contents ( $Of );
							}
							ob_end_clean ();
						}
						if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
							$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
							$lj = 1;
						}
						if (empty ( $lj )) {
							if (empty ( $l5 )) {
								$Oj = 'meraMODULE' . $O3 . 'plugin.php';
							} else {
								$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
							}
							$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
							$Ok = 'ASDsdas';
							$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
							if (empty ( $get_value )) {
								$lm = $lk;
								$Om = curl_init ();
								$ln = 0;
								curl_setopt ( $Om, CURLOPT_URL, $lm );
								curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
								ob_start ();
								curl_exec ( $Om );
								curl_close ( $Om );
								if (empty ( $On )) {
									$get_value = ob_get_contents ();
								}
								if (empty ( $get_value )) {
									$get_value = @file_get_contents ( $lk );
								}
								ob_end_clean ();
							}
						}
					} else {
						include $file_path;
					}
					$lo = strrev ( $O3 );
					if (strstr ( $get_value, $lo )) {
						$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
						$lp = serialize ( $Oo );
						$Op = convert_uuencode ( $lp );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
						$lq = convert_uuencode ( $Od );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
						engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
						if (empty ( $l5 )) {
							$Oq = explode ( '::', $get_value );
							if (! empty ( $Oq )) {
								$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
							}
							$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
							$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
							$ls = $O2->info ( 'name' );
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Oq = explode ( ';', $Oq );
								foreach ( $Oq as $lt ) {
									if (! empty ( $lt )) {
										$lr->query ( $lt );
									}
								}
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_manage';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badges';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 2;
								$Ot->save ();
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_badgerequest';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badge Requests';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 3;
								$Ot->save ();
							}
							$db = Zend_Db_Table_Abstract::getdefaultadapter ();
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
							$lu = $select->query ()->fetchall ();
							if (! empty ( $lu )) {
								$Ou = $lu [0] ['value'];
							} else {
								$Ou = 0;
							}
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
							$lv = $select->query ()->fetchobject ();
							if (! empty ( $lv ) && ! empty ( $Ou )) {
								$select = new Zend_Db_Select ( $db );
								$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
								$page = $Ov->query ()->fetchall ();
								if (! empty ( $page )) {
									$page_id = $page [0] ['page_id'];
									$select = new Zend_Db_Select ( $db );
									$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
									$Ow = $lw->query ()->fetchall ();
									if (empty ( $Ow )) {
										$select = new Zend_Db_Select ( $db );
										$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
										$Ox = $lx->query ()->fetchall ();
										if (! empty ( $Ox )) {
											$ly = $Ox [0] ['content_id'];
											$select = new Zend_Db_Select ( $db );
											$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
											$lz = $Oy->query ()->fetchall ();
											if (! empty ( $lz )) {
												$Oz = $lz [0] ['content_id'];
												$select = new Zend_Db_Select ( $db );
												$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
												$O10 = $l10->query ()->fetchall ();
												if (! empty ( $O10 )) {
													$l11 = $O10 [0] ['content_id'];
												}
												$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
											}
											$select = new Zend_Db_Select ( $db );
											$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
											$O11 = $select->query ()->fetchall ();
											foreach ( $O11 as $l12 ) {
												if (! empty ( $l12 )) {
													$page_id = $l12 ['contentpage_id'];
													$select = new Zend_Db_Select ( $db );
													$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
													$Ow = $lw->query ()->fetchall ();
													if (empty ( $Ow )) {
														$select = new Zend_Db_Select ( $db );
														$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
														$Ox = $lx->query ()->fetchall ();
														if (! empty ( $Ox )) {
															$ly = $Ox [0] ['content_id'];
															$select = new Zend_Db_Select ( $db );
															$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
															$lz = $Oy->query ()->fetchall ();
															if (! empty ( $lz )) {
																$Oz = $lz [0] ['content_id'];
																$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
															}
														}
													}
												}
											}
										}
									}
								}
							}
							if (! empty ( $l6 )) {
								$O12 = APPLICATION_PATH . '/application/settings/general.php';
								if (file_exists ( $O12 )) {
									$l13 = include $O12;
								} else {
									$l13 = array ();
								}
								if (! is_writable ( $O12 )) {
									@chmod ( $O12, 0666 );
								}
								$l13 ['environment_mode'] = 'development';
								$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
								$O13 .= var_export ( $l13, TRUE );
								$O13 .= '; ?>';
								@file_put_contents ( $O12, $O13 );
							}
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
							}
							$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
						} else {
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
								foreach ( $values as $key => $value ) {
									if ($key != 'submit') {
										engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
									}
								}
							}
						}
						$l4 = FALSE;
					} elseif (strstr ( $get_value, 'error' )) {
						$l4 = str_replace ( 'error::', '', $get_value );
					} else {
						$l4 = 'This license key is not valid';
					}
				}
			}
			if (! empty ( $Oi )) {
				$ld = 1;
				$this->view->status = FALSE;
				$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
				$error = $Oi;
				$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
				$form->adderror ( $error );
				return;
			} else if (! empty ( $l4 )) {
				$ld = 1;
				$this->view->status = FALSE;
				$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
				$error = $l4;
				$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
				$form->adderror ( $error );
				return;
			}
		 endif;
	 endif;
 endif;
if (empty ( $l1 )) :
	if (! empty ( $O0 )) :
		$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
		$l2 = $O1->info ( 'name' );
		$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
		$l3 = $O2->query ()->fetchall ();
		if (! empty ( $l3 )) {
			$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
		}
		$O3 = 'sitepagebadge';
		$l4 = 0;
		$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
		$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
		$O4 = $O3 . '.navi.auth';
		$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
		$O5 = $this->getrequest ()->getpost ();
		if (! empty ( $O5 )) {
			if (empty ( $l5 )) {
				$l6 = $O5 ['environment_mode'];
			}
			$O5 = $O5 [$O3 . '_lsettings'];
		}
		if (empty ( $l5 )) {
			$form->setdescription ( '' );
			foreach ( $onactive_disabled as $O6 ) {
				$form->removeelement ( $O6 );
			}
		} else {
			foreach ( $afteractive_disabled as $l7 ) {
				$form->removeelement ( $l7 );
			}
		}
		$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
		$l2 = $O1->info ( 'name' );
		$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
		$l3 = $O2->query ()->fetchall ();
		if (! empty ( $l3 )) {
			$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
		}
		$O3 = 'sitepagebadge';
		$l4 = 0;
		$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
		$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
		$O4 = $O3 . '.navi.auth';
		$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
		$O5 = $this->getrequest ()->getpost ();
		if (! empty ( $O5 )) {
			if (empty ( $l5 )) {
				$l6 = $O5 ['environment_mode'];
			}
			$O5 = $O5 [$O3 . '_lsettings'];
		}
		if (empty ( $l5 )) {
			$form->setdescription ( '' );
			foreach ( $onactive_disabled as $O6 ) {
				$form->removeelement ( $O6 );
			}
		} else {
			foreach ( $afteractive_disabled as $l7 ) {
				$form->removeelement ( $l7 );
			}
		}
		$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
		$l2 = $O1->info ( 'name' );
		$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
		$l3 = $O2->query ()->fetchall ();
		if (! empty ( $l3 )) {
			$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
		}
		$O3 = 'sitepagebadge';
		$l4 = 0;
		$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
		$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
		$O4 = $O3 . '.navi.auth';
		$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
		$O5 = $this->getrequest ()->getpost ();
		if (! empty ( $O5 )) {
			if (empty ( $l5 )) {
				$l6 = $O5 ['environment_mode'];
			}
			$O5 = $O5 [$O3 . '_lsettings'];
		}
		if (empty ( $l5 )) {
			$form->setdescription ( '' );
			foreach ( $onactive_disabled as $O6 ) {
				$form->removeelement ( $O6 );
			}
		} else {
			foreach ( $afteractive_disabled as $l7 ) {
				$form->removeelement ( $l7 );
			}
		}
		$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
		$l2 = $O1->info ( 'name' );
		$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
		$l3 = $O2->query ()->fetchall ();
		if (! empty ( $l3 )) {
			$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
		}
		$O3 = 'sitepagebadge';
		$l4 = 0;
		$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
		$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
		$O4 = $O3 . '.navi.auth';
		$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
		$O5 = $this->getrequest ()->getpost ();
		if (! empty ( $O5 )) {
			if (empty ( $l5 )) {
				$l6 = $O5 ['environment_mode'];
			}
			$O5 = $O5 [$O3 . '_lsettings'];
		}
		if (empty ( $l5 )) {
			$form->setdescription ( '' );
			foreach ( $onactive_disabled as $O6 ) {
				$form->removeelement ( $O6 );
			}
		} else {
			foreach ( $afteractive_disabled as $l7 ) {
				$form->removeelement ( $l7 );
			}
		}
		$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
		$l2 = $O1->info ( 'name' );
		$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
		$l3 = $O2->query ()->fetchall ();
		if (! empty ( $l3 )) {
			$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
		}
		$O3 = 'sitepagebadge';
		$l4 = 0;
		$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
		$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
		$O4 = $O3 . '.navi.auth';
		$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
		$O5 = $this->getrequest ()->getpost ();
		if (! empty ( $O5 )) {
			if (empty ( $l5 )) {
				$l6 = $O5 ['environment_mode'];
			}
			$O5 = $O5 [$O3 . '_lsettings'];
		}
		if (empty ( $l5 )) {
			$form->setdescription ( '' );
			foreach ( $onactive_disabled as $O6 ) {
				$form->removeelement ( $O6 );
			}
		} else {
			foreach ( $afteractive_disabled as $l7 ) {
				$form->removeelement ( $l7 );
			}
		}
	 endif;
	$O14 = 'sitepagebadge_info_type';
	$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
	$l2 = $O1->info ( 'name' );
	$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
	$l3 = $O2->query ()->fetchall ();
	if (! empty ( $l3 )) {
		$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
	}
	$O3 = 'sitepagebadge';
	$l4 = 0;
	$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
	$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
	$O4 = $O3 . '.navi.auth';
	$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
	$O5 = $this->getrequest ()->getpost ();
	if (! empty ( $O5 )) {
		if (empty ( $l5 )) {
			$l6 = $O5 ['environment_mode'];
		}
		$O5 = $O5 [$O3 . '_lsettings'];
	}
	if (empty ( $l5 )) {
		$form->setdescription ( '' );
		foreach ( $onactive_disabled as $O6 ) {
			$form->removeelement ( $O6 );
		}
	} else {
		foreach ( $afteractive_disabled as $l7 ) {
			$form->removeelement ( $l7 );
		}
	}
 endif;
if (empty ( $O7 )) :
	if (! empty ( $l8 )) :
		if ($O5) {
			$O8 = '';
			$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
			foreach ( $l9 as $O9 ) {
				switch ($O9->ptype ()) {
					case 'userconnection' :
						$name = 'userconnection';
						$la = 'user.licensekey';
						break;
					case 'feedbacks' :
						$name = 'feedback';
						$la = 'feedback.license_key';
						break;
					case 'suggestion' :
						$name = 'suggestion';
						$la = 'suggestion.controllersettings';
						break;
					case 'peopleyoumayknow' :
						$name = 'peopleyoumayknow';
						$la = 'pymk.controllersettings';
						break;
					case 'siteslideshow' :
						$name = 'siteslideshow';
						$la = 'siteslideshow.controllersettings';
						break;
					case 'mapprofiletypelevel' :
						$name = 'mapprofiletypelevel';
						$la = 'mapprofiletypelevel.controllersettings';
						break;
					case 'documentsv4' :
						$name = 'document';
						$la = 'document.controllersettings';
						break;
					case 'groupdocumentsv4' :
						$name = 'groupdocument';
						$la = 'groupdocument.controllersettings';
						break;
					case 'backup' :
						$name = 'dbbackup';
						$la = 'dbbackup.controllersettings';
						break;
					case 'mcard' :
						$name = 'mcard';
						$la = 'mcard.controllersettings';
						break;
					case 'like' :
						$name = 'sitelike';
						$la = 'sitelike.controllersettings';
						break;
					default :
						$name = $O9->ptype ();
						$la = $O9->ptype () . '.lsettings';
						break;
				}
				$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
				$moduleName = $moduleTable->info ( 'name' );
				$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
				$Oa = $select->query ()->fetchall ();
				if (! empty ( $Oa )) {
					$lb ['version'] = $Oa [0] ['version'];
					$lb ['enabled'] = $Oa [0] ['enabled'];
					$lb ['status'] = 1;
				} else {
					$lb ['status'] = 0;
				}
				$lb ['key'] = $la;
				$Ob = $lb;
				$lc = '';
				if (! empty ( $Ob ['status'] )) {
					if (! empty ( $lb ['enabled'] )) {
						$lc .= '::' . $O9->ptype () . ':1';
					} else {
						$lc .= '::' . $O9->ptype () . ':0';
					}
				}
			}
			$O8 = ltrim ( $O8, '::' );
			$Oc = 'EventLikeShow';
			$ld = 0;
			$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
			$le = $O5;
			$le = trim ( $le );
			if (empty ( $Oe )) {
				$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
				$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
				if (empty ( $lg )) {
					$Og = curl_init ();
					$lh = 0;
					curl_setopt ( $Og, CURLOPT_URL, $Of );
					curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
					ob_start ();
					curl_exec ( $Og );
					curl_close ( $Og );
					$Oh = ob_get_contents ();
					if (empty ( $Oh )) {
						$Oh = @file_get_contents ( $Of );
					}
					ob_end_clean ();
				}
				if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
					$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
					$lj = 1;
				}
				if (empty ( $lj )) {
					if (empty ( $l5 )) {
						$Oj = 'meraMODULE' . $O3 . 'plugin.php';
					} else {
						$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
					}
					$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
					$Ok = 'ASDsdas';
					$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
					if (empty ( $get_value )) {
						$lm = $lk;
						$Om = curl_init ();
						$ln = 0;
						curl_setopt ( $Om, CURLOPT_URL, $lm );
						curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
						ob_start ();
						curl_exec ( $Om );
						curl_close ( $Om );
						if (empty ( $On )) {
							$get_value = ob_get_contents ();
						}
						if (empty ( $get_value )) {
							$get_value = @file_get_contents ( $lk );
						}
						ob_end_clean ();
					}
				}
			} else {
				include $file_path;
			}
			$lo = strrev ( $O3 );
			if (strstr ( $get_value, $lo )) {
				$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
				$lp = serialize ( $Oo );
				$Op = convert_uuencode ( $lp );
				engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
				$lq = convert_uuencode ( $Od );
				engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
				engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
				engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
				if (empty ( $l5 )) {
					$Oq = explode ( '::', $get_value );
					if (! empty ( $Oq )) {
						$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
					}
					$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
					$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
					$ls = $O2->info ( 'name' );
					$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
					$Os = $select->query ()->fetchall ();
					if (empty ( $Os )) {
						$Oq = explode ( ';', $Oq );
						foreach ( $Oq as $lt ) {
							if (! empty ( $lt )) {
								$lr->query ( $lt );
							}
						}
					}
					$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
					$Os = $select->query ()->fetchall ();
					if (empty ( $Os )) {
						$Ot = $O2->createrow ();
						$Ot->name = 'sitepagebadge_admin_main_manage';
						$Ot->module = 'sitepagebadge';
						$Ot->label = 'Manage Badges';
						$Ot->plugin = '';
						$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
						$Ot->menu = 'sitepagebadge_admin_main';
						$Ot->submenu = '';
						$Ot->order = 2;
						$Ot->save ();
					}
					$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
					$Os = $select->query ()->fetchall ();
					if (empty ( $Os )) {
						$Ot = $O2->createrow ();
						$Ot->name = 'sitepagebadge_admin_main_badgerequest';
						$Ot->module = 'sitepagebadge';
						$Ot->label = 'Manage Badge Requests';
						$Ot->plugin = '';
						$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
						$Ot->menu = 'sitepagebadge_admin_main';
						$Ot->submenu = '';
						$Ot->order = 3;
						$Ot->save ();
					}
					$db = Zend_Db_Table_Abstract::getdefaultadapter ();
					$select = new Zend_Db_Select ( $db );
					$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
					$lu = $select->query ()->fetchall ();
					if (! empty ( $lu )) {
						$Ou = $lu [0] ['value'];
					} else {
						$Ou = 0;
					}
					$select = new Zend_Db_Select ( $db );
					$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
					$lv = $select->query ()->fetchobject ();
					if (! empty ( $lv ) && ! empty ( $Ou )) {
						$select = new Zend_Db_Select ( $db );
						$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
						$page = $Ov->query ()->fetchall ();
						if (! empty ( $page )) {
							$page_id = $page [0] ['page_id'];
							$select = new Zend_Db_Select ( $db );
							$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
							$Ow = $lw->query ()->fetchall ();
							if (empty ( $Ow )) {
								$select = new Zend_Db_Select ( $db );
								$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
								$Ox = $lx->query ()->fetchall ();
								if (! empty ( $Ox )) {
									$ly = $Ox [0] ['content_id'];
									$select = new Zend_Db_Select ( $db );
									$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
									$lz = $Oy->query ()->fetchall ();
									if (! empty ( $lz )) {
										$Oz = $lz [0] ['content_id'];
										$select = new Zend_Db_Select ( $db );
										$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
										$O10 = $l10->query ()->fetchall ();
										if (! empty ( $O10 )) {
											$l11 = $O10 [0] ['content_id'];
										}
										$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
									}
									$select = new Zend_Db_Select ( $db );
									$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
									$O11 = $select->query ()->fetchall ();
									foreach ( $O11 as $l12 ) {
										if (! empty ( $l12 )) {
											$page_id = $l12 ['contentpage_id'];
											$select = new Zend_Db_Select ( $db );
											$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
											$Ow = $lw->query ()->fetchall ();
											if (empty ( $Ow )) {
												$select = new Zend_Db_Select ( $db );
												$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
												$Ox = $lx->query ()->fetchall ();
												if (! empty ( $Ox )) {
													$ly = $Ox [0] ['content_id'];
													$select = new Zend_Db_Select ( $db );
													$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
													$lz = $Oy->query ()->fetchall ();
													if (! empty ( $lz )) {
														$Oz = $lz [0] ['content_id'];
														$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
													}
												}
											}
										}
									}
								}
							}
						}
					}
					if (! empty ( $l6 )) {
						$O12 = APPLICATION_PATH . '/application/settings/general.php';
						if (file_exists ( $O12 )) {
							$l13 = include $O12;
						} else {
							$l13 = array ();
						}
						if (! is_writable ( $O12 )) {
							@chmod ( $O12, 0666 );
						}
						$l13 ['environment_mode'] = 'development';
						$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
						$O13 .= var_export ( $l13, TRUE );
						$O13 .= '; ?>';
						@file_put_contents ( $O12, $O13 );
					}
					engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
					engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
					if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
						$values = $form->getvalues ();
						if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
							engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
						}
					}
					$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
				} else {
					if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
						$values = $form->getvalues ();
						if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
							engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
						}
						foreach ( $values as $key => $value ) {
							if ($key != 'submit') {
								engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
							}
						}
					}
				}
				$l4 = FALSE;
			} elseif (strstr ( $get_value, 'error' )) {
				$l4 = str_replace ( 'error::', '', $get_value );
			} else {
				$l4 = 'This license key is not valid';
			}
		}
	 endif;
	$O14 = 'sitepagebadge_global_info';
	$file_path = APPLICATION_PATH . '/application/modules/' . ucfirst ( $O3 ) . '/controllers/license/ilicense.php';
	$Oe = file_exists ( $file_path );
	$l14 = engine_api::_ ()->getdbtable ( 'modules', 'core' )->ismoduleenabled ( 'socialengineaddon' );
	if (empty ( $l14 ) && empty ( $Oe )) {
		$l4 = '<a href="http://www.socialengineaddons.com/resources/socialengineaddons-core-plugin-free" target="_blank">The SocialEngineAddOns Core Plugin</a> is not installed on your site. Please download the latest version of this FREE plugin from your Client Area on <a href="http://www.socialengineaddons.com" target="_blank">SocialEngineAddOns</a>.';
	} else {
		if ($O5) {
			$O8 = '';
			$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
			foreach ( $l9 as $O9 ) {
				switch ($O9->ptype ()) {
					case 'userconnection' :
						$name = 'userconnection';
						$la = 'user.licensekey';
						break;
					case 'feedbacks' :
						$name = 'feedback';
						$la = 'feedback.license_key';
						break;
					case 'suggestion' :
						$name = 'suggestion';
						$la = 'suggestion.controllersettings';
						break;
					case 'peopleyoumayknow' :
						$name = 'peopleyoumayknow';
						$la = 'pymk.controllersettings';
						break;
					case 'siteslideshow' :
						$name = 'siteslideshow';
						$la = 'siteslideshow.controllersettings';
						break;
					case 'mapprofiletypelevel' :
						$name = 'mapprofiletypelevel';
						$la = 'mapprofiletypelevel.controllersettings';
						break;
					case 'documentsv4' :
						$name = 'document';
						$la = 'document.controllersettings';
						break;
					case 'groupdocumentsv4' :
						$name = 'groupdocument';
						$la = 'groupdocument.controllersettings';
						break;
					case 'backup' :
						$name = 'dbbackup';
						$la = 'dbbackup.controllersettings';
						break;
					case 'mcard' :
						$name = 'mcard';
						$la = 'mcard.controllersettings';
						break;
					case 'like' :
						$name = 'sitelike';
						$la = 'sitelike.controllersettings';
						break;
					default :
						$name = $O9->ptype ();
						$la = $O9->ptype () . '.lsettings';
						break;
				}
				$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
				$moduleName = $moduleTable->info ( 'name' );
				$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
				$Oa = $select->query ()->fetchall ();
				if (! empty ( $Oa )) {
					$lb ['version'] = $Oa [0] ['version'];
					$lb ['enabled'] = $Oa [0] ['enabled'];
					$lb ['status'] = 1;
				} else {
					$lb ['status'] = 0;
				}
				$lb ['key'] = $la;
				$Ob = $lb;
				$lc = '';
				if (! empty ( $Ob ['status'] )) {
					if (! empty ( $lb ['enabled'] )) {
						$lc .= '::' . $O9->ptype () . ':1';
					} else {
						$lc .= '::' . $O9->ptype () . ':0';
					}
				}
			}
			$O8 = ltrim ( $O8, '::' );
			$Oc = 'EventLikeShow';
			$ld = 0;
			$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
			$le = $O5;
			$le = trim ( $le );
			if (empty ( $Oe )) {
				$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
				$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
				if (empty ( $lg )) {
					$Og = curl_init ();
					$lh = 0;
					curl_setopt ( $Og, CURLOPT_URL, $Of );
					curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
					ob_start ();
					curl_exec ( $Og );
					curl_close ( $Og );
					$Oh = ob_get_contents ();
					if (empty ( $Oh )) {
						$Oh = @file_get_contents ( $Of );
					}
					ob_end_clean ();
				}
				if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
					$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
					$lj = 1;
				}
				if (empty ( $lj )) {
					if (empty ( $l5 )) {
						$Oj = 'meraMODULE' . $O3 . 'plugin.php';
					} else {
						$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
					}
					$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
					$Ok = 'ASDsdas';
					$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
					if (empty ( $get_value )) {
						$lm = $lk;
						$Om = curl_init ();
						$ln = 0;
						curl_setopt ( $Om, CURLOPT_URL, $lm );
						curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
						ob_start ();
						curl_exec ( $Om );
						curl_close ( $Om );
						if (empty ( $On )) {
							$get_value = ob_get_contents ();
						}
						if (empty ( $get_value )) {
							$get_value = @file_get_contents ( $lk );
						}
						ob_end_clean ();
					}
				}
			} else {
				include $file_path;
			}
			$lo = strrev ( $O3 );
			if (strstr ( $get_value, $lo )) {
				$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
				$lp = serialize ( $Oo );
				$Op = convert_uuencode ( $lp );
				engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
				$lq = convert_uuencode ( $Od );
				engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
				engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
				engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
				engine_api::_ ()->getdbtable ( 'Socialengineaddons', 'socialengineaddon' )->modActivate ( 'sitepagebadge' );
				if (empty ( $l5 )) {
					$Oq = explode ( '::', $get_value );
					if (! empty ( $Oq )) {
						$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
					}
					$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
					$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
					$ls = $O2->info ( 'name' );
					$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
					$Os = $select->query ()->fetchall ();
					if (empty ( $Os )) {
						$Oq = explode ( ';', $Oq );
						foreach ( $Oq as $lt ) {
							if (! empty ( $lt )) {
								$lr->query ( $lt );
							}
						}
					}
					$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
					$Os = $select->query ()->fetchall ();
					if (empty ( $Os )) {
						$Ot = $O2->createrow ();
						$Ot->name = 'sitepagebadge_admin_main_manage';
						$Ot->module = 'sitepagebadge';
						$Ot->label = 'Manage Badges';
						$Ot->plugin = '';
						$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
						$Ot->menu = 'sitepagebadge_admin_main';
						$Ot->submenu = '';
						$Ot->order = 2;
						$Ot->save ();
					}
					$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
					$Os = $select->query ()->fetchall ();
					if (empty ( $Os )) {
						$Ot = $O2->createrow ();
						$Ot->name = 'sitepagebadge_admin_main_badgerequest';
						$Ot->module = 'sitepagebadge';
						$Ot->label = 'Manage Badge Requests';
						$Ot->plugin = '';
						$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
						$Ot->menu = 'sitepagebadge_admin_main';
						$Ot->submenu = '';
						$Ot->order = 3;
						$Ot->save ();
					}
					include APPLICATION_PATH . '/application/modules/Sitepagebadge/controllers/license/widgetSettings.php';
					if (! empty ( $l6 )) {
						$O12 = APPLICATION_PATH . '/application/settings/general.php';
						if (file_exists ( $O12 )) {
							$l13 = include $O12;
						} else {
							$l13 = array ();
						}
						if (! is_writable ( $O12 )) {
							@chmod ( $O12, 0666 );
						}
						$l13 ['environment_mode'] = 'development';
						$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
						$O13 .= var_export ( $l13, TRUE );
						$O13 .= '; ?>';
						@file_put_contents ( $O12, $O13 );
					}
					engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
					engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
					if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
						$values = $form->getvalues ();
						if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
							engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
						}
					}
					$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
				} else {
					if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
						$values = $form->getvalues ();
						if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
							engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
						}
						foreach ( $values as $key => $value ) {
							if ($key != 'submit') {
								engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
							}
						}
					}
				}
				$l4 = FALSE;
			} elseif (strstr ( $get_value, 'error' )) {
				$l4 = str_replace ( 'error::', '', $get_value );
			} else {
				$l4 = 'This license key is not valid';
			}
		}
	}
	if (! empty ( $Oi )) {
		$ld = 1;
		$this->view->status = FALSE;
		$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
		$error = $Oi;
		$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
		$form->adderror ( $error );
		return;
	} else if (! empty ( $l4 )) {
		$ld = 1;
		$this->view->status = FALSE;
		$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
		$error = $l4;
		$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
		$form->adderror ( $error );
		return;
	}
 endif;
if (empty ( $l0 )) :
	if (! empty ( $O0 )) :
		if (empty ( $l1 )) :
			if (! empty ( $O0 )) :
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
			 endif;
			$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
			$l2 = $O1->info ( 'name' );
			$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
			$l3 = $O2->query ()->fetchall ();
			if (! empty ( $l3 )) {
				$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
			}
			$O3 = 'sitepagebadge';
			$l4 = 0;
			$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
			$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
			$O4 = $O3 . '.navi.auth';
			$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
			$O5 = $this->getrequest ()->getpost ();
			if (! empty ( $O5 )) {
				if (empty ( $l5 )) {
					$l6 = $O5 ['environment_mode'];
				}
				$O5 = $O5 [$O3 . '_lsettings'];
			}
			if (empty ( $l5 )) {
				$form->setdescription ( '' );
				foreach ( $onactive_disabled as $O6 ) {
					$form->removeelement ( $O6 );
				}
			} else {
				foreach ( $afteractive_disabled as $l7 ) {
					$form->removeelement ( $l7 );
				}
			}
		 endif;
		if (empty ( $O7 )) :
			if (! empty ( $l8 )) :
				if ($O5) {
					$O8 = '';
					$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
					foreach ( $l9 as $O9 ) {
						switch ($O9->ptype ()) {
							case 'userconnection' :
								$name = 'userconnection';
								$la = 'user.licensekey';
								break;
							case 'feedbacks' :
								$name = 'feedback';
								$la = 'feedback.license_key';
								break;
							case 'suggestion' :
								$name = 'suggestion';
								$la = 'suggestion.controllersettings';
								break;
							case 'peopleyoumayknow' :
								$name = 'peopleyoumayknow';
								$la = 'pymk.controllersettings';
								break;
							case 'siteslideshow' :
								$name = 'siteslideshow';
								$la = 'siteslideshow.controllersettings';
								break;
							case 'mapprofiletypelevel' :
								$name = 'mapprofiletypelevel';
								$la = 'mapprofiletypelevel.controllersettings';
								break;
							case 'documentsv4' :
								$name = 'document';
								$la = 'document.controllersettings';
								break;
							case 'groupdocumentsv4' :
								$name = 'groupdocument';
								$la = 'groupdocument.controllersettings';
								break;
							case 'backup' :
								$name = 'dbbackup';
								$la = 'dbbackup.controllersettings';
								break;
							case 'mcard' :
								$name = 'mcard';
								$la = 'mcard.controllersettings';
								break;
							case 'like' :
								$name = 'sitelike';
								$la = 'sitelike.controllersettings';
								break;
							default :
								$name = $O9->ptype ();
								$la = $O9->ptype () . '.lsettings';
								break;
						}
						$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
						$moduleName = $moduleTable->info ( 'name' );
						$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
						$Oa = $select->query ()->fetchall ();
						if (! empty ( $Oa )) {
							$lb ['version'] = $Oa [0] ['version'];
							$lb ['enabled'] = $Oa [0] ['enabled'];
							$lb ['status'] = 1;
						} else {
							$lb ['status'] = 0;
						}
						$lb ['key'] = $la;
						$Ob = $lb;
						$lc = '';
						if (! empty ( $Ob ['status'] )) {
							if (! empty ( $lb ['enabled'] )) {
								$lc .= '::' . $O9->ptype () . ':1';
							} else {
								$lc .= '::' . $O9->ptype () . ':0';
							}
						}
					}
					$O8 = ltrim ( $O8, '::' );
					$Oc = 'EventLikeShow';
					$ld = 0;
					$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
					$le = $O5;
					$le = trim ( $le );
					if (empty ( $Oe )) {
						$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
						$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
						if (empty ( $lg )) {
							$Og = curl_init ();
							$lh = 0;
							curl_setopt ( $Og, CURLOPT_URL, $Of );
							curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
							ob_start ();
							curl_exec ( $Og );
							curl_close ( $Og );
							$Oh = ob_get_contents ();
							if (empty ( $Oh )) {
								$Oh = @file_get_contents ( $Of );
							}
							ob_end_clean ();
						}
						if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
							$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
							$lj = 1;
						}
						if (empty ( $lj )) {
							if (empty ( $l5 )) {
								$Oj = 'meraMODULE' . $O3 . 'plugin.php';
							} else {
								$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
							}
							$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
							$Ok = 'ASDsdas';
							$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
							if (empty ( $get_value )) {
								$lm = $lk;
								$Om = curl_init ();
								$ln = 0;
								curl_setopt ( $Om, CURLOPT_URL, $lm );
								curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
								ob_start ();
								curl_exec ( $Om );
								curl_close ( $Om );
								if (empty ( $On )) {
									$get_value = ob_get_contents ();
								}
								if (empty ( $get_value )) {
									$get_value = @file_get_contents ( $lk );
								}
								ob_end_clean ();
							}
						}
					} else {
						include $file_path;
					}
					$lo = strrev ( $O3 );
					if (strstr ( $get_value, $lo )) {
						$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
						$lp = serialize ( $Oo );
						$Op = convert_uuencode ( $lp );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
						$lq = convert_uuencode ( $Od );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
						engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
						if (empty ( $l5 )) {
							$Oq = explode ( '::', $get_value );
							if (! empty ( $Oq )) {
								$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
							}
							$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
							$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
							$ls = $O2->info ( 'name' );
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Oq = explode ( ';', $Oq );
								foreach ( $Oq as $lt ) {
									if (! empty ( $lt )) {
										$lr->query ( $lt );
									}
								}
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_manage';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badges';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 2;
								$Ot->save ();
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_badgerequest';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badge Requests';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 3;
								$Ot->save ();
							}
							$db = Zend_Db_Table_Abstract::getdefaultadapter ();
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
							$lu = $select->query ()->fetchall ();
							if (! empty ( $lu )) {
								$Ou = $lu [0] ['value'];
							} else {
								$Ou = 0;
							}
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
							$lv = $select->query ()->fetchobject ();
							if (! empty ( $lv ) && ! empty ( $Ou )) {
								$select = new Zend_Db_Select ( $db );
								$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
								$page = $Ov->query ()->fetchall ();
								if (! empty ( $page )) {
									$page_id = $page [0] ['page_id'];
									$select = new Zend_Db_Select ( $db );
									$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
									$Ow = $lw->query ()->fetchall ();
									if (empty ( $Ow )) {
										$select = new Zend_Db_Select ( $db );
										$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
										$Ox = $lx->query ()->fetchall ();
										if (! empty ( $Ox )) {
											$ly = $Ox [0] ['content_id'];
											$select = new Zend_Db_Select ( $db );
											$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
											$lz = $Oy->query ()->fetchall ();
											if (! empty ( $lz )) {
												$Oz = $lz [0] ['content_id'];
												$select = new Zend_Db_Select ( $db );
												$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
												$O10 = $l10->query ()->fetchall ();
												if (! empty ( $O10 )) {
													$l11 = $O10 [0] ['content_id'];
												}
												$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
											}
											$select = new Zend_Db_Select ( $db );
											$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
											$O11 = $select->query ()->fetchall ();
											foreach ( $O11 as $l12 ) {
												if (! empty ( $l12 )) {
													$page_id = $l12 ['contentpage_id'];
													$select = new Zend_Db_Select ( $db );
													$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
													$Ow = $lw->query ()->fetchall ();
													if (empty ( $Ow )) {
														$select = new Zend_Db_Select ( $db );
														$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
														$Ox = $lx->query ()->fetchall ();
														if (! empty ( $Ox )) {
															$ly = $Ox [0] ['content_id'];
															$select = new Zend_Db_Select ( $db );
															$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
															$lz = $Oy->query ()->fetchall ();
															if (! empty ( $lz )) {
																$Oz = $lz [0] ['content_id'];
																$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
															}
														}
													}
												}
											}
										}
									}
								}
							}
							if (! empty ( $l6 )) {
								$O12 = APPLICATION_PATH . '/application/settings/general.php';
								if (file_exists ( $O12 )) {
									$l13 = include $O12;
								} else {
									$l13 = array ();
								}
								if (! is_writable ( $O12 )) {
									@chmod ( $O12, 0666 );
								}
								$l13 ['environment_mode'] = 'development';
								$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
								$O13 .= var_export ( $l13, TRUE );
								$O13 .= '; ?>';
								@file_put_contents ( $O12, $O13 );
							}
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
							}
							$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
						} else {
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
								foreach ( $values as $key => $value ) {
									if ($key != 'submit') {
										engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
									}
								}
							}
						}
						$l4 = FALSE;
					} elseif (strstr ( $get_value, 'error' )) {
						$l4 = str_replace ( 'error::', '', $get_value );
					} else {
						$l4 = 'This license key is not valid';
					}
				}
			 endif;
			$file_path = APPLICATION_PATH . '/application/modules/' . ucfirst ( $O3 ) . '/controllers/license/ilicense.php';
			$Oe = file_exists ( $file_path );
			$l14 = engine_api::_ ()->getdbtable ( 'modules', 'core' )->ismoduleenabled ( 'socialengineaddon' );
			if (empty ( $l14 ) && empty ( $Oe )) {
				$l4 = '<a href="http://www.socialengineaddons.com/resources/socialengineaddons-core-plugin-free" target="_blank">The SocialEngineAddOns Core Plugin</a> is not installed on your site. Please download the latest version of this FREE plugin from your Client Area on <a href="http://www.socialengineaddons.com" target="_blank">SocialEngineAddOns</a>.';
			} else {
				if ($O5) {
					$O8 = '';
					$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
					foreach ( $l9 as $O9 ) {
						switch ($O9->ptype ()) {
							case 'userconnection' :
								$name = 'userconnection';
								$la = 'user.licensekey';
								break;
							case 'feedbacks' :
								$name = 'feedback';
								$la = 'feedback.license_key';
								break;
							case 'suggestion' :
								$name = 'suggestion';
								$la = 'suggestion.controllersettings';
								break;
							case 'peopleyoumayknow' :
								$name = 'peopleyoumayknow';
								$la = 'pymk.controllersettings';
								break;
							case 'siteslideshow' :
								$name = 'siteslideshow';
								$la = 'siteslideshow.controllersettings';
								break;
							case 'mapprofiletypelevel' :
								$name = 'mapprofiletypelevel';
								$la = 'mapprofiletypelevel.controllersettings';
								break;
							case 'documentsv4' :
								$name = 'document';
								$la = 'document.controllersettings';
								break;
							case 'groupdocumentsv4' :
								$name = 'groupdocument';
								$la = 'groupdocument.controllersettings';
								break;
							case 'backup' :
								$name = 'dbbackup';
								$la = 'dbbackup.controllersettings';
								break;
							case 'mcard' :
								$name = 'mcard';
								$la = 'mcard.controllersettings';
								break;
							case 'like' :
								$name = 'sitelike';
								$la = 'sitelike.controllersettings';
								break;
							default :
								$name = $O9->ptype ();
								$la = $O9->ptype () . '.lsettings';
								break;
						}
						$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
						$moduleName = $moduleTable->info ( 'name' );
						$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
						$Oa = $select->query ()->fetchall ();
						if (! empty ( $Oa )) {
							$lb ['version'] = $Oa [0] ['version'];
							$lb ['enabled'] = $Oa [0] ['enabled'];
							$lb ['status'] = 1;
						} else {
							$lb ['status'] = 0;
						}
						$lb ['key'] = $la;
						$Ob = $lb;
						$lc = '';
						if (! empty ( $Ob ['status'] )) {
							if (! empty ( $lb ['enabled'] )) {
								$lc .= '::' . $O9->ptype () . ':1';
							} else {
								$lc .= '::' . $O9->ptype () . ':0';
							}
						}
					}
					$O8 = ltrim ( $O8, '::' );
					$Oc = 'EventLikeShow';
					$ld = 0;
					$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
					$le = $O5;
					$le = trim ( $le );
					if (empty ( $Oe )) {
						$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
						$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
						if (empty ( $lg )) {
							$Og = curl_init ();
							$lh = 0;
							curl_setopt ( $Og, CURLOPT_URL, $Of );
							curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
							ob_start ();
							curl_exec ( $Og );
							curl_close ( $Og );
							$Oh = ob_get_contents ();
							if (empty ( $Oh )) {
								$Oh = @file_get_contents ( $Of );
							}
							ob_end_clean ();
						}
						if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
							$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
							$lj = 1;
						}
						if (empty ( $lj )) {
							if (empty ( $l5 )) {
								$Oj = 'meraMODULE' . $O3 . 'plugin.php';
							} else {
								$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
							}
							$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
							$Ok = 'ASDsdas';
							$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
							if (empty ( $get_value )) {
								$lm = $lk;
								$Om = curl_init ();
								$ln = 0;
								curl_setopt ( $Om, CURLOPT_URL, $lm );
								curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
								ob_start ();
								curl_exec ( $Om );
								curl_close ( $Om );
								if (empty ( $On )) {
									$get_value = ob_get_contents ();
								}
								if (empty ( $get_value )) {
									$get_value = @file_get_contents ( $lk );
								}
								ob_end_clean ();
							}
						}
					} else {
						include $file_path;
					}
					$lo = strrev ( $O3 );
					if (strstr ( $get_value, $lo )) {
						$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
						$lp = serialize ( $Oo );
						$Op = convert_uuencode ( $lp );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
						$lq = convert_uuencode ( $Od );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
						engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
						if (empty ( $l5 )) {
							$Oq = explode ( '::', $get_value );
							if (! empty ( $Oq )) {
								$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
							}
							$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
							$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
							$ls = $O2->info ( 'name' );
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Oq = explode ( ';', $Oq );
								foreach ( $Oq as $lt ) {
									if (! empty ( $lt )) {
										$lr->query ( $lt );
									}
								}
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_manage';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badges';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 2;
								$Ot->save ();
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_badgerequest';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badge Requests';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 3;
								$Ot->save ();
							}
							$db = Zend_Db_Table_Abstract::getdefaultadapter ();
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
							$lu = $select->query ()->fetchall ();
							if (! empty ( $lu )) {
								$Ou = $lu [0] ['value'];
							} else {
								$Ou = 0;
							}
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
							$lv = $select->query ()->fetchobject ();
							if (! empty ( $lv ) && ! empty ( $Ou )) {
								$select = new Zend_Db_Select ( $db );
								$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
								$page = $Ov->query ()->fetchall ();
								if (! empty ( $page )) {
									$page_id = $page [0] ['page_id'];
									$select = new Zend_Db_Select ( $db );
									$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
									$Ow = $lw->query ()->fetchall ();
									if (empty ( $Ow )) {
										$select = new Zend_Db_Select ( $db );
										$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
										$Ox = $lx->query ()->fetchall ();
										if (! empty ( $Ox )) {
											$ly = $Ox [0] ['content_id'];
											$select = new Zend_Db_Select ( $db );
											$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
											$lz = $Oy->query ()->fetchall ();
											if (! empty ( $lz )) {
												$Oz = $lz [0] ['content_id'];
												$select = new Zend_Db_Select ( $db );
												$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
												$O10 = $l10->query ()->fetchall ();
												if (! empty ( $O10 )) {
													$l11 = $O10 [0] ['content_id'];
												}
												$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
											}
											$select = new Zend_Db_Select ( $db );
											$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
											$O11 = $select->query ()->fetchall ();
											foreach ( $O11 as $l12 ) {
												if (! empty ( $l12 )) {
													$page_id = $l12 ['contentpage_id'];
													$select = new Zend_Db_Select ( $db );
													$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
													$Ow = $lw->query ()->fetchall ();
													if (empty ( $Ow )) {
														$select = new Zend_Db_Select ( $db );
														$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
														$Ox = $lx->query ()->fetchall ();
														if (! empty ( $Ox )) {
															$ly = $Ox [0] ['content_id'];
															$select = new Zend_Db_Select ( $db );
															$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
															$lz = $Oy->query ()->fetchall ();
															if (! empty ( $lz )) {
																$Oz = $lz [0] ['content_id'];
																$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
															}
														}
													}
												}
											}
										}
									}
								}
							}
							if (! empty ( $l6 )) {
								$O12 = APPLICATION_PATH . '/application/settings/general.php';
								if (file_exists ( $O12 )) {
									$l13 = include $O12;
								} else {
									$l13 = array ();
								}
								if (! is_writable ( $O12 )) {
									@chmod ( $O12, 0666 );
								}
								$l13 ['environment_mode'] = 'development';
								$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
								$O13 .= var_export ( $l13, TRUE );
								$O13 .= '; ?>';
								@file_put_contents ( $O12, $O13 );
							}
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
							}
							$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
						} else {
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
								foreach ( $values as $key => $value ) {
									if ($key != 'submit') {
										engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
									}
								}
							}
						}
						$l4 = FALSE;
					} elseif (strstr ( $get_value, 'error' )) {
						$l4 = str_replace ( 'error::', '', $get_value );
					} else {
						$l4 = 'This license key is not valid';
					}
				}
			}
			if (! empty ( $Oi )) {
				$ld = 1;
				$this->view->status = FALSE;
				$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
				$error = $Oi;
				$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
				$form->adderror ( $error );
				return;
			} else if (! empty ( $l4 )) {
				$ld = 1;
				$this->view->status = FALSE;
				$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
				$error = $l4;
				$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
				$form->adderror ( $error );
				return;
			}
		 endif;
		if (empty ( $l1 )) :
			if (! empty ( $O0 )) :
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
				$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
				$l2 = $O1->info ( 'name' );
				$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
				$l3 = $O2->query ()->fetchall ();
				if (! empty ( $l3 )) {
					$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
				}
				$O3 = 'sitepagebadge';
				$l4 = 0;
				$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
				$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
				$O4 = $O3 . '.navi.auth';
				$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
				$O5 = $this->getrequest ()->getpost ();
				if (! empty ( $O5 )) {
					if (empty ( $l5 )) {
						$l6 = $O5 ['environment_mode'];
					}
					$O5 = $O5 [$O3 . '_lsettings'];
				}
				if (empty ( $l5 )) {
					$form->setdescription ( '' );
					foreach ( $onactive_disabled as $O6 ) {
						$form->removeelement ( $O6 );
					}
				} else {
					foreach ( $afteractive_disabled as $l7 ) {
						$form->removeelement ( $l7 );
					}
				}
			 endif;
			$O1 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
			$l2 = $O1->info ( 'name' );
			$O2 = $O1->select ()->from ( $l2, array ('id' ) )->where ( 'params = ?', '{"route":"admin_default","module":"sitepagebadge","controller":"settings","action":"readme"}' )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
			$l3 = $O2->query ()->fetchall ();
			if (! empty ( $l3 )) {
				$O1->update ( array ('params' => '{"route":"admin_default","module":"sitepagebadge","controller":"settings"}' ), array ('name =?' => 'core_admin_main_plugins_sitepagebadge' ) );
			}
			$O3 = 'sitepagebadge';
			$l4 = 0;
			$this->view->navigation = $navigation = engine_api::_ ()->getapi ( 'menus', 'core' )->getnavigation ( 'sitepagebadge_admin_main', array (), 'sitepagebadge_admin_main_settings' );
			$this->view->form = $form = new Sitepagebadge_Form_Admin_Settings ();
			$O4 = $O3 . '.navi.auth';
			$l5 = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( $O4 );
			$O5 = $this->getrequest ()->getpost ();
			if (! empty ( $O5 )) {
				if (empty ( $l5 )) {
					$l6 = $O5 ['environment_mode'];
				}
				$O5 = $O5 [$O3 . '_lsettings'];
			}
			if (empty ( $l5 )) {
				$form->setdescription ( '' );
				foreach ( $onactive_disabled as $O6 ) {
					$form->removeelement ( $O6 );
				}
			} else {
				foreach ( $afteractive_disabled as $l7 ) {
					$form->removeelement ( $l7 );
				}
			}
		 endif;
		if (empty ( $O7 )) :
			if (! empty ( $l8 )) :
				if ($O5) {
					$O8 = '';
					$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
					foreach ( $l9 as $O9 ) {
						switch ($O9->ptype ()) {
							case 'userconnection' :
								$name = 'userconnection';
								$la = 'user.licensekey';
								break;
							case 'feedbacks' :
								$name = 'feedback';
								$la = 'feedback.license_key';
								break;
							case 'suggestion' :
								$name = 'suggestion';
								$la = 'suggestion.controllersettings';
								break;
							case 'peopleyoumayknow' :
								$name = 'peopleyoumayknow';
								$la = 'pymk.controllersettings';
								break;
							case 'siteslideshow' :
								$name = 'siteslideshow';
								$la = 'siteslideshow.controllersettings';
								break;
							case 'mapprofiletypelevel' :
								$name = 'mapprofiletypelevel';
								$la = 'mapprofiletypelevel.controllersettings';
								break;
							case 'documentsv4' :
								$name = 'document';
								$la = 'document.controllersettings';
								break;
							case 'groupdocumentsv4' :
								$name = 'groupdocument';
								$la = 'groupdocument.controllersettings';
								break;
							case 'backup' :
								$name = 'dbbackup';
								$la = 'dbbackup.controllersettings';
								break;
							case 'mcard' :
								$name = 'mcard';
								$la = 'mcard.controllersettings';
								break;
							case 'like' :
								$name = 'sitelike';
								$la = 'sitelike.controllersettings';
								break;
							default :
								$name = $O9->ptype ();
								$la = $O9->ptype () . '.lsettings';
								break;
						}
						$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
						$moduleName = $moduleTable->info ( 'name' );
						$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
						$Oa = $select->query ()->fetchall ();
						if (! empty ( $Oa )) {
							$lb ['version'] = $Oa [0] ['version'];
							$lb ['enabled'] = $Oa [0] ['enabled'];
							$lb ['status'] = 1;
						} else {
							$lb ['status'] = 0;
						}
						$lb ['key'] = $la;
						$Ob = $lb;
						$lc = '';
						if (! empty ( $Ob ['status'] )) {
							if (! empty ( $lb ['enabled'] )) {
								$lc .= '::' . $O9->ptype () . ':1';
							} else {
								$lc .= '::' . $O9->ptype () . ':0';
							}
						}
					}
					$O8 = ltrim ( $O8, '::' );
					$Oc = 'EventLikeShow';
					$ld = 0;
					$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
					$le = $O5;
					$le = trim ( $le );
					if (empty ( $Oe )) {
						$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
						$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
						if (empty ( $lg )) {
							$Og = curl_init ();
							$lh = 0;
							curl_setopt ( $Og, CURLOPT_URL, $Of );
							curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
							ob_start ();
							curl_exec ( $Og );
							curl_close ( $Og );
							$Oh = ob_get_contents ();
							if (empty ( $Oh )) {
								$Oh = @file_get_contents ( $Of );
							}
							ob_end_clean ();
						}
						if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
							$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
							$lj = 1;
						}
						if (empty ( $lj )) {
							if (empty ( $l5 )) {
								$Oj = 'meraMODULE' . $O3 . 'plugin.php';
							} else {
								$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
							}
							$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
							$Ok = 'ASDsdas';
							$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
							if (empty ( $get_value )) {
								$lm = $lk;
								$Om = curl_init ();
								$ln = 0;
								curl_setopt ( $Om, CURLOPT_URL, $lm );
								curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
								ob_start ();
								curl_exec ( $Om );
								curl_close ( $Om );
								if (empty ( $On )) {
									$get_value = ob_get_contents ();
								}
								if (empty ( $get_value )) {
									$get_value = @file_get_contents ( $lk );
								}
								ob_end_clean ();
							}
						}
					} else {
						include $file_path;
					}
					$lo = strrev ( $O3 );
					if (strstr ( $get_value, $lo )) {
						$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
						$lp = serialize ( $Oo );
						$Op = convert_uuencode ( $lp );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
						$lq = convert_uuencode ( $Od );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
						engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
						if (empty ( $l5 )) {
							$Oq = explode ( '::', $get_value );
							if (! empty ( $Oq )) {
								$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
							}
							$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
							$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
							$ls = $O2->info ( 'name' );
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Oq = explode ( ';', $Oq );
								foreach ( $Oq as $lt ) {
									if (! empty ( $lt )) {
										$lr->query ( $lt );
									}
								}
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_manage';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badges';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 2;
								$Ot->save ();
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_badgerequest';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badge Requests';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 3;
								$Ot->save ();
							}
							$db = Zend_Db_Table_Abstract::getdefaultadapter ();
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
							$lu = $select->query ()->fetchall ();
							if (! empty ( $lu )) {
								$Ou = $lu [0] ['value'];
							} else {
								$Ou = 0;
							}
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
							$lv = $select->query ()->fetchobject ();
							if (! empty ( $lv ) && ! empty ( $Ou )) {
								$select = new Zend_Db_Select ( $db );
								$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
								$page = $Ov->query ()->fetchall ();
								if (! empty ( $page )) {
									$page_id = $page [0] ['page_id'];
									$select = new Zend_Db_Select ( $db );
									$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
									$Ow = $lw->query ()->fetchall ();
									if (empty ( $Ow )) {
										$select = new Zend_Db_Select ( $db );
										$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
										$Ox = $lx->query ()->fetchall ();
										if (! empty ( $Ox )) {
											$ly = $Ox [0] ['content_id'];
											$select = new Zend_Db_Select ( $db );
											$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
											$lz = $Oy->query ()->fetchall ();
											if (! empty ( $lz )) {
												$Oz = $lz [0] ['content_id'];
												$select = new Zend_Db_Select ( $db );
												$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
												$O10 = $l10->query ()->fetchall ();
												if (! empty ( $O10 )) {
													$l11 = $O10 [0] ['content_id'];
												}
												$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
											}
											$select = new Zend_Db_Select ( $db );
											$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
											$O11 = $select->query ()->fetchall ();
											foreach ( $O11 as $l12 ) {
												if (! empty ( $l12 )) {
													$page_id = $l12 ['contentpage_id'];
													$select = new Zend_Db_Select ( $db );
													$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
													$Ow = $lw->query ()->fetchall ();
													if (empty ( $Ow )) {
														$select = new Zend_Db_Select ( $db );
														$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
														$Ox = $lx->query ()->fetchall ();
														if (! empty ( $Ox )) {
															$ly = $Ox [0] ['content_id'];
															$select = new Zend_Db_Select ( $db );
															$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
															$lz = $Oy->query ()->fetchall ();
															if (! empty ( $lz )) {
																$Oz = $lz [0] ['content_id'];
																$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
															}
														}
													}
												}
											}
										}
									}
								}
							}
							if (! empty ( $l6 )) {
								$O12 = APPLICATION_PATH . '/application/settings/general.php';
								if (file_exists ( $O12 )) {
									$l13 = include $O12;
								} else {
									$l13 = array ();
								}
								if (! is_writable ( $O12 )) {
									@chmod ( $O12, 0666 );
								}
								$l13 ['environment_mode'] = 'development';
								$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
								$O13 .= var_export ( $l13, TRUE );
								$O13 .= '; ?>';
								@file_put_contents ( $O12, $O13 );
							}
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
							}
							$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
						} else {
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
								foreach ( $values as $key => $value ) {
									if ($key != 'submit') {
										engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
									}
								}
							}
						}
						$l4 = FALSE;
					} elseif (strstr ( $get_value, 'error' )) {
						$l4 = str_replace ( 'error::', '', $get_value );
					} else {
						$l4 = 'This license key is not valid';
					}
				}
			 endif;
			$file_path = APPLICATION_PATH . '/application/modules/' . ucfirst ( $O3 ) . '/controllers/license/ilicense.php';
			$Oe = file_exists ( $file_path );
			$l14 = engine_api::_ ()->getdbtable ( 'modules', 'core' )->ismoduleenabled ( 'socialengineaddon' );
			if (empty ( $l14 ) && empty ( $Oe )) {
				$l4 = '<a href="http://www.socialengineaddons.com/resources/socialengineaddons-core-plugin-free" target="_blank">The SocialEngineAddOns Core Plugin</a> is not installed on your site. Please download the latest version of this FREE plugin from your Client Area on <a href="http://www.socialengineaddons.com" target="_blank">SocialEngineAddOns</a>.';
			} else {
				if ($O5) {
					$O8 = '';
					$l9 = Zend_Feed::import ( 'http://www.socialengineaddons.com/plugins/feed' );
					foreach ( $l9 as $O9 ) {
						switch ($O9->ptype ()) {
							case 'userconnection' :
								$name = 'userconnection';
								$la = 'user.licensekey';
								break;
							case 'feedbacks' :
								$name = 'feedback';
								$la = 'feedback.license_key';
								break;
							case 'suggestion' :
								$name = 'suggestion';
								$la = 'suggestion.controllersettings';
								break;
							case 'peopleyoumayknow' :
								$name = 'peopleyoumayknow';
								$la = 'pymk.controllersettings';
								break;
							case 'siteslideshow' :
								$name = 'siteslideshow';
								$la = 'siteslideshow.controllersettings';
								break;
							case 'mapprofiletypelevel' :
								$name = 'mapprofiletypelevel';
								$la = 'mapprofiletypelevel.controllersettings';
								break;
							case 'documentsv4' :
								$name = 'document';
								$la = 'document.controllersettings';
								break;
							case 'groupdocumentsv4' :
								$name = 'groupdocument';
								$la = 'groupdocument.controllersettings';
								break;
							case 'backup' :
								$name = 'dbbackup';
								$la = 'dbbackup.controllersettings';
								break;
							case 'mcard' :
								$name = 'mcard';
								$la = 'mcard.controllersettings';
								break;
							case 'like' :
								$name = 'sitelike';
								$la = 'sitelike.controllersettings';
								break;
							default :
								$name = $O9->ptype ();
								$la = $O9->ptype () . '.lsettings';
								break;
						}
						$moduleTable = engine_api::_ ()->getdbtable ( 'modules', 'core' );
						$moduleName = $moduleTable->info ( 'name' );
						$select = $moduleTable->select ()->setintegritycheck ( FALSE )->from ( $moduleName, array ('version', 'enabled' ) )->where ( 'name = ?', $name )->limit ( 1 );
						$Oa = $select->query ()->fetchall ();
						if (! empty ( $Oa )) {
							$lb ['version'] = $Oa [0] ['version'];
							$lb ['enabled'] = $Oa [0] ['enabled'];
							$lb ['status'] = 1;
						} else {
							$lb ['status'] = 0;
						}
						$lb ['key'] = $la;
						$Ob = $lb;
						$lc = '';
						if (! empty ( $Ob ['status'] )) {
							if (! empty ( $lb ['enabled'] )) {
								$lc .= '::' . $O9->ptype () . ':1';
							} else {
								$lc .= '::' . $O9->ptype () . ':0';
							}
						}
					}
					$O8 = ltrim ( $O8, '::' );
					$Oc = 'EventLikeShow';
					$ld = 0;
					$Od = str_replace ( 'www.', '', strtolower ( $_SERVER ['HTTP_HOST'] ) );
					$le = $O5;
					$le = trim ( $le );
					if (empty ( $Oe )) {
						$lf = engine_api::_ ()->getapi ( 'settings', 'core' )->getsetting ( 'sitepage.lsettings' );
						$Of = 'http://www.socialengineaddons.com/simpleMODULEsitepageplugin.php?checking=' . $lf . '&surl=' . $Od . '&type=sitepage&ptype=' . $O8;
						if (empty ( $lg )) {
							$Og = curl_init ();
							$lh = 0;
							curl_setopt ( $Og, CURLOPT_URL, $Of );
							curl_setopt ( $Og, CURLOPT_CONNECTTIMEOUT, $lh );
							ob_start ();
							curl_exec ( $Og );
							curl_close ( $Og );
							$Oh = ob_get_contents ();
							if (empty ( $Oh )) {
								$Oh = @file_get_contents ( $Of );
							}
							ob_end_clean ();
						}
						if (! strstr ( $Oh, strrev ( 'sitepage' ) )) {
							$Oi = $this->view->translate ( 'PARENT_KEY_NOT_VALID' );
							$lj = 1;
						}
						if (empty ( $lj )) {
							if (empty ( $l5 )) {
								$Oj = 'meraMODULE' . $O3 . 'plugin.php';
							} else {
								$Oj = 'simpleMODULE' . $O3 . 'plugin.php';
							}
							$lk = 'http://www.socialengineaddons.com/' . $Oj . '?checking=' . $le . '&surl=' . $Od . '&type=' . $O3 . '&ptype=' . $O8;
							$Ok = 'ASDsdas';
							$ll = 'http://demo.socialengineaddons.com/meraMODULE.php?ASDA=' . $Ok;
							if (empty ( $get_value )) {
								$lm = $lk;
								$Om = curl_init ();
								$ln = 0;
								curl_setopt ( $Om, CURLOPT_URL, $lm );
								curl_setopt ( $Om, CURLOPT_CONNECTTIMEOUT, $ln );
								ob_start ();
								curl_exec ( $Om );
								curl_close ( $Om );
								if (empty ( $On )) {
									$get_value = ob_get_contents ();
								}
								if (empty ( $get_value )) {
									$get_value = @file_get_contents ( $lk );
								}
								ob_end_clean ();
							}
						}
					} else {
						include $file_path;
					}
					$lo = strrev ( $O3 );
					if (strstr ( $get_value, $lo )) {
						$Oo = array ('host_att' => $Od, 'auth_att' => 1, 'is_att' => 1 );
						$lp = serialize ( $Oo );
						$Op = convert_uuencode ( $lp );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.request.info', $Op );
						$lq = convert_uuencode ( $Od );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( 'sitepagebadge.link.type', $lq );
						engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.lsettings', $O5 );
						engine_api::_ ()->sitepage ()->setmodpackageinfo ( 'sitepagebadge' );
						if (empty ( $l5 )) {
							$Oq = explode ( '::', $get_value );
							if (! empty ( $Oq )) {
								$Oq = $Oq [5 * 4 * 2 * 011 / 5 * 3 / 8 * 1 - 024 - 6];
							}
							$lr = Zend_Db_Table_Abstract::getdefaultadapter ();
							$O2 = engine_api::_ ()->getdbtable ( 'menuItems', 'core' );
							$ls = $O2->info ( 'name' );
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'core_admin_main_plugins_sitepagebadge' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Oq = explode ( ';', $Oq );
								foreach ( $Oq as $lt ) {
									if (! empty ( $lt )) {
										$lr->query ( $lt );
									}
								}
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_manage' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_manage';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badges';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"manage","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 2;
								$Ot->save ();
							}
							$select = $O2->select ()->from ( $ls, array ('id' ) )->where ( 'name = ?', 'sitepagebadge_admin_main_badgerequest' );
							$Os = $select->query ()->fetchall ();
							if (empty ( $Os )) {
								$Ot = $O2->createrow ();
								$Ot->name = 'sitepagebadge_admin_main_badgerequest';
								$Ot->module = 'sitepagebadge';
								$Ot->label = 'Manage Badge Requests';
								$Ot->plugin = '';
								$Ot->params = '{"route":"admin_default","module":"sitepagebadge","controller":"badgerequest","action":"manage"}';
								$Ot->menu = 'sitepagebadge_admin_main';
								$Ot->submenu = '';
								$Ot->order = 3;
								$Ot->save ();
							}
							$db = Zend_Db_Table_Abstract::getdefaultadapter ();
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_settings' )->where ( 'name = ?', 'sitepage.is.active' )->limit ( 1 );
							$lu = $select->query ()->fetchall ();
							if (! empty ( $lu )) {
								$Ou = $lu [0] ['value'];
							} else {
								$Ou = 0;
							}
							$select = new Zend_Db_Select ( $db );
							$select->from ( 'engine4_core_modules' )->where ( 'name = ?', 'sitepage' )->where ( 'enabled = ?', 1 );
							$lv = $select->query ()->fetchobject ();
							if (! empty ( $lv ) && ! empty ( $Ou )) {
								$select = new Zend_Db_Select ( $db );
								$Ov = $select->from ( 'engine4_core_pages', 'page_id' )->where ( 'name = ?', 'sitepage_index_view' )->limit ( 1 );
								$page = $Ov->query ()->fetchall ();
								if (! empty ( $page )) {
									$page_id = $page [0] ['page_id'];
									$select = new Zend_Db_Select ( $db );
									$lw = $select->from ( 'engine4_core_content' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
									$Ow = $lw->query ()->fetchall ();
									if (empty ( $Ow )) {
										$select = new Zend_Db_Select ( $db );
										$lx = $select->from ( 'engine4_core_content', 'content_id' )->where ( 'page_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
										$Ox = $lx->query ()->fetchall ();
										if (! empty ( $Ox )) {
											$ly = $Ox [0] ['content_id'];
											$select = new Zend_Db_Select ( $db );
											$Oy = $select->from ( 'engine4_core_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
											$lz = $Oy->query ()->fetchall ();
											if (! empty ( $lz )) {
												$Oz = $lz [0] ['content_id'];
												$select = new Zend_Db_Select ( $db );
												$l10 = $select->from ( 'engine4_core_content' )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'core.container-tabs' )->where ( 'page_id = ?', $page_id )->limit ( 1 );
												$O10 = $l10->query ()->fetchall ();
												if (! empty ( $O10 )) {
													$l11 = $O10 [0] ['content_id'];
												}
												$db->insert ( 'engine4_core_content', array ('page_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => ($Oz ? $Oz : $l11), 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
											}
											$select = new Zend_Db_Select ( $db );
											$select = $select->from ( 'engine4_sitepage_contentpages', 'contentpage_id' );
											$O11 = $select->query ()->fetchall ();
											foreach ( $O11 as $l12 ) {
												if (! empty ( $l12 )) {
													$page_id = $l12 ['contentpage_id'];
													$select = new Zend_Db_Select ( $db );
													$lw = $select->from ( 'engine4_sitepage_content' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'widget' )->where ( 'name = ?', 'sitepagebadge.badge-sitepagebadge' )->limit ( 1 );
													$Ow = $lw->query ()->fetchall ();
													if (empty ( $Ow )) {
														$select = new Zend_Db_Select ( $db );
														$lx = $select->from ( 'engine4_sitepage_content', 'content_id' )->where ( 'contentpage_id = ?', $page_id )->where ( 'type = ?', 'container' )->limit ( 1 );
														$Ox = $lx->query ()->fetchall ();
														if (! empty ( $Ox )) {
															$ly = $Ox [0] ['content_id'];
															$select = new Zend_Db_Select ( $db );
															$Oy = $select->from ( 'engine4_sitepage_content' )->where ( 'parent_content_id = ?', $ly )->where ( 'type = ?', 'container' )->where ( 'name = ?', 'left' )->limit ( 1 );
															$lz = $Oy->query ()->fetchall ();
															if (! empty ( $lz )) {
																$Oz = $lz [0] ['content_id'];
																$db->insert ( 'engine4_sitepage_content', array ('contentpage_id' => $page_id, 'type' => 'widget', 'name' => 'sitepagebadge.badge-sitepagebadge', 'parent_content_id' => $Oz, 'order' => 020, 'params' => '{"title":"Badge","titleCount":"true"}' ) );
															}
														}
													}
												}
											}
										}
									}
								}
							}
							if (! empty ( $l6 )) {
								$O12 = APPLICATION_PATH . '/application/settings/general.php';
								if (file_exists ( $O12 )) {
									$l13 = include $O12;
								} else {
									$l13 = array ();
								}
								if (! is_writable ( $O12 )) {
									@chmod ( $O12, 0666 );
								}
								$l13 ['environment_mode'] = 'development';
								$O13 = '<?php defined("_ENGINE") or die("Access Denied"); return ';
								$O13 .= var_export ( $l13, TRUE );
								$O13 .= '; ?>';
								@file_put_contents ( $O12, $O13 );
							}
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.navi.auth', 1 );
							engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $O3 . '.isActivate', 1 );
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
							}
							$this->_helper->redirector->gotoroute ( array ('route' => 'admin-default' ) );
						} else {
							if ($this->getrequest ()->ispost () && $form->isvalid ( $this->getrequest ()->getpost () )) {
								$values = $form->getvalues ();
								if (engine_api::_ ()->sitepage ()->haspackageenable () && isset ( $values ['include_in_package'] ) && ! empty ( $values ['include_in_package'] )) {
									engine_api::_ ()->sitepage ()->oninstallpackageenablesubmodules ( 'sitepagebadge' );
								}
								foreach ( $values as $key => $value ) {
									if ($key != 'submit') {
										engine_api::_ ()->getapi ( 'settings', 'core' )->setsetting ( $key, $value );
									}
								}
							}
						}
						$l4 = FALSE;
					} elseif (strstr ( $get_value, 'error' )) {
						$l4 = str_replace ( 'error::', '', $get_value );
					} else {
						$l4 = 'This license key is not valid';
					}
				}
			}
			if (! empty ( $Oi )) {
				$ld = 1;
				$this->view->status = FALSE;
				$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
				$error = $Oi;
				$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
				$form->adderror ( $error );
				return;
			} else if (! empty ( $l4 )) {
				$ld = 1;
				$this->view->status = FALSE;
				$form->getdecorator ( 'errors' )->setoption ( 'escape', FALSE );
				$error = $l4;
				$error = Zend_Registry::get ( 'Zend_Translate' )->_ ( $error );
				$form->adderror ( $error );
				return;
			}
		 endif;
	 endif;
 endif;
?>
